package meatslope2.constants;

import javax.microedition.khronos.opengles.GL10;

import meatslope2.application.IGameContext;
import meatslope2.application.R;
import meatslope2.application.SystemRegistry;
import meatslope2.gameengine.gameobjects.model.Sprite;
import meatslope2.gameengine.helpers.BitmapLoader;

/**
 * Be sure to add additional sprites to the spritesToLoad array.  This is bad design, I know, I'm sorry.
 * @author Mitchell Thelen
 *
 */
public class SpriteConstants 
{
	// ===========================================================
	// Constants
	// ===========================================================
	
	//Units
	public static final Sprite PLAYER = new Sprite(R.drawable.chris);
	
	//Tiles
	public static final Sprite BLOCK = new Sprite(R.drawable.tile);
	public static final Sprite RAMP_LEFT_1 = new Sprite(R.drawable.tile_left_tilt_1);
	public static final Sprite RAMP_LEFT_2 = new Sprite(R.drawable.tile_left_tilt_2);
	public static final Sprite RAMP_RIGHT_1 = new Sprite(R.drawable.tile_right_tilt_1);
	public static final Sprite RAMP_RIGHT_2 = new Sprite(R.drawable.tile_right_tilt_2);
	
	//HUD
	public static final Sprite LEFT_THUMBSTICK = new Sprite(R.drawable.thumb);
	public static final Sprite LEFT_THUMBSTICK_OUTER = new Sprite(R.drawable.thumbstick_outer);
	
	public static final Sprite ARROW_LEFT = new Sprite(R.drawable.arrow_left);
	public static final Sprite ARROW_RIGHT = new Sprite(R.drawable.arrow_right);
	
	public static final Sprite JUMP = new Sprite(R.drawable.jump);
	public static final Sprite JUMP_BAR = new Sprite(R.drawable.jump_bar);
	
	//Background
	public static final Sprite BACKGROUND = new Sprite(R.drawable.background); //TODO: nuke this
	
	private static final Sprite[] spritesToLoad = new Sprite[]
	{
		PLAYER,
		BLOCK,
		RAMP_LEFT_1,
		RAMP_LEFT_2,
		RAMP_RIGHT_1,
		RAMP_RIGHT_2,
		LEFT_THUMBSTICK,
		BACKGROUND,
		LEFT_THUMBSTICK_OUTER,
		ARROW_LEFT,
		ARROW_RIGHT,
		JUMP,
		JUMP_BAR
	};
	
	// ===========================================================
	// Constructors
	// ===========================================================
	/**
	 * loads the bitmap in {@link tiles}
	 */
	public static void loadSprites(IGameContext gameContext, GL10 pGL) 
	{
		BitmapLoader bitmapLoader = SystemRegistry.bitmapLoader;
		
		for(int i = 0; i < spritesToLoad.length; i++)
			bitmapLoader.loadBitmap(gameContext, pGL, spritesToLoad[i]);
	}	
}
